/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**
 *  @author     Andrew Wei
 *  @portfolio  http://andrewwei.mu
 *
 *  ©2012 Andrew Wei
 *
 *  This software is released under the MIT License:
 *  http://www.opensource.org/licenses/mit-license.php
 **++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**/
package com.ghoztudios.display
{
    import com.ghoztudios.events.EnhancedEvent;
    import com.ghoztudios.events.ViewEvent;
    import com.ghoztudios.helper.Director;

    /**
     * A generic template for an application screen.
     *
     * @langversion     3.0
     * @playerversion   Flash 10.3.183.20
     */
    public class View extends SpriteOnStage
    {
        private static const ID:String = 'com.ghoztudios.display.Page';


        // Private Properties
        /**
         * Unique ID of View instance.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        private var _id:int               = -1;

        /**
         * View name.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        private var _viewName:String      = null;

        /**
         * Directory of subviews.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        private var _directory:Array      = null;

        /**
         * Boolean value indicating whether the View instance is registered.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        private var _isRegistered:Boolean = false;


        // Getter Methods
        /**
         * Gets the ID of the View.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function get id():int { return _id; }

        /**
         * Gets the current View name.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function get viewName():String { return _viewName; }

        /**
         * Gets the directory array.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function get directory():Array { return _directory; }

        /**
         * Gets the registered flag.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function get registered():Boolean { return _isRegistered; }


        // Initialization
        /**
         * Creates a new View instance.
         *
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function View():void {}


        // Protected Methods
        /**
         * Event handler when subview changes.
         *
         * @param   $event
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        protected function _subpageChangeHandler($event:ViewEvent):void {}


        // Public Methods
        /**
         * Sets up the view.
         *
         * @param   $id
         * @param   $pageName
         * @param   $directory
         * @langversion     3.0
         * @playerversion   Flash 10.3.183.20
         */
        public function setup($id:int, $viewName:String, $directory:Array):void
        {
            _id           = $id;
            _viewName     = $viewName;
            _directory    = $directory;
            _isRegistered = true;
        }
    }
}
